clear all;


born19202000 = [39.42544746	42.66381024	41.81356173	39.10242501	41.45351593	40.76142571	43.71323631	43.14959774	43.72357005	44.05711733	44.80626835	45.79458785	44.00932079	44.31223399	44.59583441	44.89648662	43.47469539	44.78223075	43.12081339	43.66002987	43.00737422	41.09777069	40.29280452	40.05955844	39.63774993	38.66441026	38.01985888	37.1561257	39.66594079	42.36310369	43.29287094	48.03667002	43.32494575	42.28305417	42.00334495	42.70143375	42.23513591	38.94654656	39.21145547	38.92550647	37.52834139	36.47247324	35.6924286	34.74367826	33.18433813	31.50343879	31.36212584	27.62184954	28.41311499	27.48956279	27.09349537	25.57053342	24.07963689	23.72431429	23.38723527	22.9765546	25.92671934	23.75632392	24.107038	24.41240261	23.38468117	22.96997196	22.08079368	20.550909	19.5904407	18.03229192	15.92176699	16.00226052	17.23521054	15.72322706	16.55307166	15.70655135	15.53948967	15.58615231	15.32039683	15.50338012	15.18967728	15.07425692	12.43411886	12.88856305	13.7594397
]


for i = 1: 81
    reference_born((6*i-5):6*i) = born19202000(i) / 1000;  
end

population(1) = 300;

for i = 1:100
   born(i) = 0.045;
   death(i) = (i+70)^(-0.8);
end

for j = 101:500
    born(j) = 0.0035 + (j-65)^(-0.9);
    death(j) = (j+70)^(-0.8);
end

for k = 2:500
    population(k) = population(k-1) * (1 + born(k)) * (1 - death(k));
end

for age = 1:11
    age_death(age) = (age+3)^(-2);
end
for age = 12:100
    age_death(age) = ((exp((age+6)*0.115) - 1)/200000 );
end

age_death(80)
age_death(85)


figure(1)
plot(1:500,born,'o-',1:500,death,'x-',1:length(reference_born),reference_born,'+-')
figure(2)
plot(1:500,population,'*-')
figure(3)
plot(1:length(age_death),age_death,'o-');
grid on;
